package node;

import lexer.LexType;
import parser.Parser;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class FuncRParamsNode extends ASTNode {
    public final String name = "<FuncRParams>";
    // FuncRParams → Exp { ',' Exp }
    private List<ExpNode> expNodes = new ArrayList<>();

    public FuncRParamsNode(List<ExpNode> expNode) {
        this.expNodes = expNode;
    }

    public FuncRParamsNode() {
    }

    public List<ExpNode> getExpNodes() {
        return expNodes;
    }

    public void setExpNode(List<ExpNode> expNodes) {
        this.expNodes = expNodes;
    }

    @Override
    public void show() throws IOException {
        for (int i = 0; i < expNodes.size(); i++) {
            expNodes.get(i).show();
            if (i != expNodes.size() - 1) {
                Parser.parserWriter.write(LexType.COMMA + " " + "," + "\n");
            }
        }
        Parser.parserWriter.write(name + "\n");
    }
}
